A client, e.g., a browser, sends an HTTP request to a web server and receives an HTTP response from the web server in order to receive a service therefrom. As the HTTP operates on a transmission control protocol (TCP), a TCP connection, first of all, should be made between a client and the web server before the service starts. The web server can execute two or more processes to handle requests of numerous clients. Such a web server is called a multi-process web server.
FIG. 1 is a drawing for explaining a configuration and an operation of a multi-process web server according to the prior art.
By referring to FIG. 1, the multi-process web server 10 according to the prior art includes a listener processor 11, one or more kernel buffers 12-1 and 12-2, one or more handler processors 13-1 and 13-2, and a shared memory 14. Preferably, the web server 10 may have two or more kernel buffers and two or more handler processors, but for convenience of explanation, it is held up as an example that there are the two kernel buffers 12-1 and 12-2 and the two handler processors 13-1 and 13-2. The listener processor 11 transmits a file descriptor (fd) representing a TCP connection between the web server 10 and a client 20 to a specific kernel buffer among the multiple kernel buffers 12-1 and 12-2. The specific kernel buffer temporarily stores the received file descriptor and then delivers it to a specified handler processor. In general, the respective handler processors 13-1 and 13-2 maintain connections with at least one client 20 through the file descriptor received from the listener processor 11 and send HTTP requests and receive HTTP responses on the basis of the connections.
More specifically, FIG. 1 illustrates that 100 clients want to make new connections at the same time while a first handler processor 13-1 has already 7949 file descriptors and a second handler processor 13-2 has already 7950. The listener processor 11 compares the number of file descriptors held by the first handler processor 13-1 with that by the second handler processor 13-2 in reference to memory area F[1] and F[2] in a shared memory in order to deliver the respective newly connected file descriptors one by one to the first or the second handler processor which has a smaller number of file descriptors. Although the number of file descriptors, i.e., 7949, held by the first handler processor 13-1 is smaller than that, i.e., 7950, by the second handler processor 13-2, the first handler processor 13-1 may not receive a first new file descriptor because it is busy handling the already-received file descriptors. In this case, the first new file descriptor is stored in a first kernel buffer 12-1 corresponding to the first handler processor 13-1 and waits until the first handler processor 13-1 can handle the first new file descriptor. Then, if the listener processor 11 acquires a second new file descriptor, the listener processor 11 compares the number of file descriptors held by the first handler processor 13-1 with that by the second handler processor 13-2 by referring to the memory area F[1] and F[2] in the shared memory again in order to transmit the second new file descriptor to the first or the second handler processor which has a smaller number of file descriptors. As the first handler processor 13-1 is busy handling the already-received file descriptors, the memory area F[1] may have not been updated yet. Accordingly, the number of file descriptors held by the first handler processor 13-1 is determined to be less than that by the second handler processor 13-2 and therefore, the listener processor 11 delivers the second new file descriptor to the first kernel buffer 12-1 corresponding to the first handler processor 13-1. If this is repeated, 100 newly connected file descriptors are delivered to the first kernel buffer 12-1 corresponding to the first handler processor 13-1 in an instant. At the end, the first handler processor 13-1 and the second handler processor 13-2, respectively, will hold 8049 and 7950 file descriptors. Accordingly, the new 100 file descriptors fail to be equally distributed to both the first and the second handler processors. Furthermore, if each hander is limited to have only 8000 file descriptors, 49 file descriptors stored in the first kernel buffer 12-1 corresponding to the first handler processor 13-1 may be thrown out without delivering to the first handler processor 13-1.
Meanwhile, according to another prior art, a technology in which the listening processor 11 determines degrees of maintaining connections with the clients 20 by individual multiple handler processors 13-1 and 13-2 and then distributes each of the new file descriptors to an appropriate handler processor with a lower degree of maintaining the connection therewith has been introduced. Even though each of the new file descriptors are distributed to the appropriate handler processor with the lower degree of maintaining the connection with the clients 20, problems such as failing to be distributed equally or occurring a congestion situation are continuously generated.